package com.company;

public class Test08aaaaaa {
    public static void main(String[] args) {
        for(int i=0;i<10;i++){
            System.out.println(he(3,i));
        }

    }

    /**
     * 求和s=a+aa+aaa+...
     * @param num
     * @param length
     * @return
     */
    public static int he(int num,int length){
        int sum = 0;
        int cup = 0;
        for(int i=0;i<length;i++){
            cup = (int) (cup + num*Math.pow(10,i));
            sum = sum +cup;
        }
        return sum;
    }
}
